home *** CD-ROM | disk | FTP | other *** search
/ SPACE 1 / SPACE - Library 1 - Volume 1.iso / program / 385 / prg_1 / prg_1ep.s < prev    next >
Text File  |  1985-11-19  |  3KB  |  62 lines

  1.  ; Program Name: PRG_1EP.S
  2.  ;      Version: 1.002
  3.  
  4.  ; Assembly Instructions:
  5.  
  6.  ;    Assemble in AssemPro PC-relative mode and save the assembled program
  7.  ; program with PRG and TOS extensions.
  8.  
  9.  ; Program Function:
  10.  
  11.  ; Illustrates a method of program organization which places declarations
  12.  ; at the beginning of a program.
  13.  
  14.  ; Note - We have not defined a program stack.  We are using the default
  15.  ;        system stack located at $4DB8, according to Internals p. 276.
  16.  
  17.  bra.s      print_string  ; Jump over the declarations below.
  18.  
  19. string:     dc.b 'This string will not overwrite the AssemPro debugger screen.'
  20.             dc.b $D,$A,0  ; The string is continued on this line.  Here, we
  21.                           ; declare a carriage return and linefeed, then
  22.                           ; terminate the entire string with a NULL = 0.
  23. newline: dc.b $D,$A,0     ; All strings must be NULL terminated because the
  24.                           ; function we are used to print them requires it.
  25.  
  26.  align      ; This is the assembler pseudo-op that forces the next
  27.             ; instruction to start at a word boundary.  It is necessary
  28.             ; because we have declared byte data above and we don't care to
  29.             ; count the bytes to confirm that there is an even number of 
  30.             ; byte-size data.
  31.  
  32.  text       ; This is an assembler pseudo-op.  dc.b is a pseudo-op also.  We
  33.             ; can define the string above the source code if we put this
  34.             ; pseudo-op between the declaration and the text of the source.
  35.             ; Of course, since the processor will attempt to execute the
  36.             ; first thing it sees, whether it be an instruction or data, we
  37.             ; must jump over the data.  You don't jump when the data is
  38.             ; actually an instruction you want to execute, such as when an
  39.             ; a-line (illegal) instruction is declared as data.
  40.  
  41. print_string:         
  42.  pea        newline             ; Prints a carriage return and linefeed.
  43.  move.w     #9, -(sp)           ; Function = c_conws = GEMDOS $9.
  44.  trap       #1                
  45.  addq.l     #6, sp
  46.  
  47.  pea        string              ; Push address of the string onto stack.
  48.  move.w     #9, -(sp)           ; Function = c_conws = GEMDOS $9.
  49.  trap       #1                  ; GEMDOS call
  50.  addq.l     #6, sp              ; Reset stack pointer to top of stack.
  51.  
  52. wait_for_keypress: 
  53.  move.w     #8, -(sp)           ; Function = c_necin = GEMDOS $8.
  54.  trap       #1                  ; GEMDOS call.
  55.  addq.l     #2, sp              ; Reposition stack pointer at top of stack.
  56.  
  57. terminate:                      ; My descriptive label.
  58.  move.w    #0, -(sp)            ; Function = p_term_old = GEMDOS $0.
  59.  trap      #1                   ; GEMDOS call.
  60.  
  61.  end                            ; Assembler pseudo-op.
  62.